package com.puris.servlet.student;

import com.puris.service.student.ServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Sonata
 * @data 2021/11/21 17:05
 */
public class SelectCompetitionServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ServiceImpl service = new ServiceImpl();
        StringBuffer competition = service.selectCompetition();

        req.setAttribute("competition", competition);
        req.getRequestDispatcher("jsp/student/joinCompetition.jsp").forward(req, resp);
    }
}
